<template>
  <div>
    <h1>学校名:{{ name }}</h1>
    <h1>地址:{{ adress }}</h1>
  </div>
</template>

<script>
export default {
  name: 'School',
  data() {
    return {
      name: '安工大',
      adress: '马鞍山',
    }
  },
  methods: {
    demo(data) {
      console.log('我是School组件,收到了数据：', data)
    },
  },
  mounted() {
    this.$bus.$on('demo', this.demo)
  },
  beforeDestroy() {
    this.$bus.$off('demo')
  },
}
</script>

<style></style>
